<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../layui/css/layui.css">
</head>
<body>
    <button  id="btn" data-method="offset" data-type="auto" class="layui-btn layui-btn-normal">居中弹出</button>
</body>
</html>
<script src="../layui/layui.js"></script>
<script>
    layui.use('layer', function(){
        var $ = layui.jquery,
         layer = layui.layer; 
      document.getElementById("btn").onclick=()=>{
        layer.open({
            type:0,
            content :"我被点击了"

        })
      }


    });
</script>